package light.head.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * 消息接收人信息
 * @author Jian
 */
@Entity
@Table
@IdClass(MessageReceivePK.class)
public class MessageReceive implements Serializable {

	private static final long serialVersionUID = 5885883244759120194L;
	
	
	private Integer mc;						// 消息编号
	private Integer ruc;					// 接收用户编号
	private Boolean iv;						// 是否查看
	private Boolean deleted;				// 是否删除
	
	private String run;						// 接收用户姓名（目前在回复时当作DTO来使用，因此不做任何数据库操作）
	
	
	

	@Id
	@Column
	public Integer getMc() {
		return mc;
	}
	@Id
	@Column
	public Integer getRuc() {
		return ruc;
	}
	@Column
	public Boolean getIv() {
		return iv;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}

	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = ruc)")
	public String getRun() {
		return run;
	}
	
	
	
	
	
	
	public void setMc(Integer mc) {
		this.mc = mc;
	}
	public void setRuc(Integer ruc) {
		this.ruc = ruc;
	}
	public void setIv(Boolean iv) {
		this.iv = iv;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setRun(String run) {
		this.run = run;
	}
}
